package LeXin;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        ArrayList<String> range = getRange(str);
        Collections.sort(range, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.toLowerCase().compareTo(o2.toLowerCase());
            }
        });
        StringBuilder sb = new StringBuilder();
        for (String s : range) {
            sb.append(s + ',');
        }
        sb.deleteCharAt(sb.length() - 1);
        System.out.print(sb.toString());
    }


    public static ArrayList<String> getRange(String str) {
        ArrayList<String> list = new ArrayList<>();
        if (str == null || str.trim().equals("")) {
            return list;
        }
        char[] charArray = str.toCharArray();
        allRange(charArray, 0, charArray.length, list);
        Collections.sort(list);
        return list;
    }

    private static void allRange(char[] src, int start, int end, ArrayList<String> list) {
        if (start == end && !list.contains(String.valueOf(src))) {
            list.add(String.valueOf(src));
        } else {
            for (int i = start; i < end; i++) {
                if (i != start && src[ i ] == src[ start ])
                    continue;
                char temp = src[ start ];
                src[ start ] = src[ i ];
                src[ i ] = temp;
                allRange(src, start + 1, end, list);
                temp = src[ start ];
                src[ start ] = src[ i ];
                src[ i ] = temp;
            }
        }
    }
}
